import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
// 引入 Tailwind CSS
import './assets/tailwind.css'
import { initI18n } from '@/plugins/i18n.js';

// 异步初始化应用
const initApp = async () => {
  const app = createApp(App);
  app.use(router);
  app.use(ElementPlus);
  
  // 初始化国际化插件
  const i18n = await initI18n();
  app.use(i18n);
  
  // 初始化主题
  const savedTheme = localStorage.getItem("theme") || "white";
  document.body.classList.add(`theme-${savedTheme}`);
  
  app.mount('#app');
};

initApp();